<template>
	<!-- title部分 -->
	<view class="title">
		<view class="title_leftbox" @click="goToShezhi">
			<image class="title_leftbox_image_fanhui" src="../../static/返回.png"></image>
		</view>
		<view class="title_middlebox">
			<view class="title_middlebox_text">切换服务器</view>
		</view>
		<view class="title_rightbox">
			<!-- <image class="title_rightbox_img" src="../../static/wenhao.png"></image> -->
		</view>
	</view>

	<!-- 切换服务器部分 -->
	<view class="qiehuanfuwiqibox">
		<view class="qiehuanfuwiqibox_text1" :class="{ 'selected': selectedServer === 'server1' }"
			@click="selectServer('server1')">
			服务器1
		</view>
		<view class="qiehuanfuwiqibox_text1" :class="{ 'selected': selectedServer === 'server2' }"
			@click="selectServer('server2')">
			服务器2
		</view>
	</view>

	<!-- 最后部分 -->

	<view class="xuanzebox">
		<view class="xuanzebox_text" @click="goToShezhi">取消</view>
		<view class="xuanzebox_text" @click="goToShezhi">确定</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				selectedServer: 'server1' // 默认选中服务器1
			}
		},
		methods: {
			// 跳转到我的资料页面
			goToShezhi() {
				uni.navigateTo({
					url: '/pages/shezhi/shezhi',
				});
			},
			selectServer(server) {
				this.selectedServer = server;
			}
		}
	}
</script>

<style>
	/* 以下是title部分样式 */
	.title {
		background-color: rgb(226, 50, 52);
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 2%;
	}

	.title_leftbox {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.title_leftbox_image_fanhui {
		width: 20px;
		height: 25px;
	}

	.title_middlebox {
		flex-grow: 1;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.title_middlebox_text {
		font-size: 16px;
		color: white;
		font-weight: 700;
	}

	.title_rightbox {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	/* 切换服务器部分样式 */
	.qiehuanfuwiqibox {
		padding: 2%;
		margin-top: 5%;
	}

	.qiehuanfuwiqibox_text1 {
		font-size: 15px;
		width: 40%;
		margin: 3% auto;
		text-align: center;
		padding: 3% 8%;
		border-radius: 50px;
		border: 1px solid #e0e0e0;
		transition: all 0.3s ease;
	}

	.qiehuanfuwiqibox_text1.selected {
		color: rgb(226, 50, 52);
		border-color: rgb(226, 50, 52);
	}

	/* 最后部分 */

	.xuanzebox {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 5%;
		margin-top: 5%;
	}

	.xuanzebox_text {
		font-size: 15px;
		padding: 2% 15%;
		border: 1px solid #e23234;
		border-radius: 50px;
		color: #e23234
	}
</style>
